/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package daos;

import beans.Bean;
import beans.TurnoBean;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Milene
 */
public class MSSQLProcesarTurnoPacienteDao extends MSSQLDao implements Dao {

    public MSSQLProcesarTurnoPacienteDao() throws Exception {
        super();
    }

    @Override
    public Bean make(ResultSet result) throws Exception {
       
        TurnoBean tb = new TurnoBean();
        tb.setEstadoTurno(result.getString("estado"));
        tb.setFechaHora(result.getDate("fecha_hora"));
        tb.setEspecialidad(result.getString("especialidad"));
        tb.setNombreProfesional(result.getString("profesional"));
        tb.setIdPaciente(result.getInt("id_paciente"));
        return tb;
    }

    @Override
    public int insert(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
 
    @Override
    public List<Bean> select(Bean bean) throws Exception {
         ResultSet result;
        List<Bean> turnos=new ArrayList<>();
        this.setStatement("get_turno_paciente(?)");
        this.getStatement().setInt(1,((TurnoBean)bean).getIdPaciente());
        result=this.getStatement().executeQuery();
        while(result.next()){            
            turnos.add(this.make(result));
        }
        
        return turnos;
    }

        
    

    @Override
    public boolean valid(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Bean get(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    
    @Override
    public long getSize(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int update(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int delete(Bean bean) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    
    
    
}
